package com.zbkj.crmeb.enums;

import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * 币种
 * @author daigb
 * @date:  2022-03-18 16:32
 */
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum CurrencyEnum {
	CN(1, "人民币"), 
	HK(2, "港币"),
	EUR(3, "欧元"),
	BA(4, "保税区"), 
	FR(5, "法郎"),
	KR(6, "韩元"), 
	AUS(7, "澳元"),
	GER(8, "德元"), 
	JPN(9, "日元"),
	US(10, "美元"),
	;

	Integer code;
	String name;

	public Integer getCode() {
		return code;
	}

	public void setCode(Integer code) {
		this.code = code;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public static CurrencyEnum valueOf(Integer code) {
		for (CurrencyEnum value : values()) {
			if (value.getCode() == code) {
				return value;
			}
		}

		return null;
	}
	
	private CurrencyEnum(Integer code, String name) {
		this.code = code;
		this.name = name;
	}

}
